Skip to content

[3.13] gh-153005: Use a monotonic clock for concurrent.interpreters Queue timeouts (GH-154156) - #156019

Merged
serhiy-storchaka merged 1 commit into
python:3.13from
BHUVANSH855:backport-154156-3.13
Aug 20, 2026
Merged

[3.13] gh-153005: Use a monotonic clock for concurrent.interpreters Queue timeouts (GH-154156)#156019
serhiy-storchaka merged 1 commit into
python:3.13from
BHUVANSH855:backport-154156-3.13

Conversation

@BHUVANSH855

@BHUVANSH855 BHUVANSH855 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Backport GH-154156 to Python 3.13.

concurrent.interpreters.Queue.get() and Queue.put() now use time.monotonic() for timeout deadlines and checks, avoiding incorrect waits when the system wall clock changes.

Tests:

  • ./python -m test test_interpreters.test_queues -j0

…eue timeouts (pythonGH-154156)

Queue.get() and Queue.put() computed their timeout deadline from
time.time(), the wall clock. If the system clock was stepped (NTP, a
manual change) while a call was blocked, the timeout could over- or
under-wait. queue.Queue uses time.monotonic() for the same reason.

Compute the deadline and check it against time.monotonic() instead.

(cherry picked from commit b94b9c8)
@serhiy-storchaka

Copy link
Copy Markdown
Member

Thank you for your backports @BHUVANSH855, but usually this is a work of the original author or a core developer who merged the original PR to create backports.

@BHUVANSH855

BHUVANSH855 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for your backports @BHUVANSH855, but usually this is a work of the original author or a core developer who merged the original PR to create backports.

I see the backports was pending, so i seen and observed the changes made and feel like i can do this, so I did that just for help and tried to reduce some backlog.

I will take care and will not make PRs without confirming with the author or the merger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants